package com.caocaog.market.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 店铺配送管理
 *
 * @author chechen
 * @date 2021-11-30
 */
@Data
@TableName("mk_shop_delivery")
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "mk_shop_delivery对象", description = "店铺配送管理")
public class ShopDelivery implements Serializable {
    private static final long serialVersionUID = 1L;

    /**主键*/
    @TableId(type = IdType.INPUT)
    private String shopId;

    /**起始价格*/
    private BigDecimal startPrice;

    /**起始公里*/
    private BigDecimal startKilometer;

    /**超出价格*/
    private BigDecimal exceedPrice;

    /**超出公里*/
    private BigDecimal exceedKilometer;

    /**区间*/
    private String intervalRange;

    /**版本号*/
    @TableField(update = "%s+1")
    private Integer lockVersion;

    public ShopDelivery(ShopDeliveryHis shopDeliveryHis) {
        // 主表的 shopId 赋值给历史表的 shopId
        this.shopId = shopDeliveryHis.getShopId();
        this.startPrice = shopDeliveryHis.getStartPrice();
        this.startKilometer = shopDeliveryHis.getStartKilometer();
        this.exceedPrice = shopDeliveryHis.getExceedPrice();
        this.exceedKilometer = shopDeliveryHis.getExceedKilometer();
        this.intervalRange = shopDeliveryHis.getIntervalRange();
        this.lockVersion = shopDeliveryHis.getLockVersion();
    }

}
